package 集合.day3.demo4;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class Test {
    String name="abc";
    int age;
    public static void main(String[] args)throws Exception {
        Properties p=new Properties();
        p.setProperty("one","1111");

        System.out.println(p.getProperty("one"));


        Reader r=new FileReader("d:/1.properties");
        p.load(r);//把文件中内容读取到集合中
        Set<Map.Entry<Object,Object>> sets=p.entrySet();
        p.keySet();
        p.values();
        for(Map.Entry e:sets){
            System.out.println(e.getKey()+"="+e.getValue());
        }
        p.setProperty("嘿嘿","8888");
        Writer w=new FileWriter("d:/1.properties");
        p.store(w,"afdsfdsf");

    }

    @Override
    public int hashCode() {
        return name.hashCode()+age;
    }

    @Override
    public boolean equals(Object obj) {

        return true;
    }
}
